<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<div>div</div>
<p>p</p>
<div>div</div>
<span>span</span>
<p>p</p>
<div>div</div>
</body>
<script>
    function select( selector ) {
        return document.querySelectorAll( selector );
    }
    var nodes = select( 'div, p');
    console.log( nodes );

</script>
</html>